﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

namespace WinHBM.Core.Net.Sockets.Cmd
{
    public class LogCmd : SocketCmd
    {

        private static readonly log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(LogCmd));

        public override void executeCmd(JObject request, FlashSocketServer socket)
        {
            string content = request["content"].ToString();
            string level = request["level"].ToString();
            if (level.Equals("debug"))
            {
                Logger.Debug("as -> " + content);
            }
            else if (level.Equals("info"))
            {
                Logger.Info("as -> " + content);
            }
            else if (level.Equals("warn"))
            {
                Logger.Warn("as -> " + content);
            }
            else if (level.Equals("error"))
            {
                Logger.Error("as -> " + content);
            }
            else if (level.Equals("fatal"))
            {
                Logger.Fatal("as -> " + content);
            }
        }
    }
}
